<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    {$LOAD_STYLE.top|raw}
<style>
    .color-box{
        width: 100px;
        height: 40px;
        border-radius: 5px;
    }
    .color_code{
        font-size: 18px;
/*        border: 1px solid #e6e6e6;
        border-radius: 10px; */
    }
</style>
<script src="__JS__/clipboard.min.js"></script>
</head>
	<body class="pear-container">
		<div class="layui-card">
			<div class="layui-card-body">
				<form class="layui-form layui-form-pane" action="">
					<div class="layui-form-item">
                           
               <div class="layui-form-item layui-inline">
                   <label class="layui-form-label">面料编号</label>
                   <div class="layui-input-inline">
                       <input type="text" name="fabric_code" placeholder="" class="layui-input">
                   </div>
               </div>   
               <div class="layui-form-item layui-inline">
                   <label class="layui-form-label">色号</label>
                   <div class="layui-input-inline">
                       <input type="text" name="color_code" placeholder="" class="layui-input">
                   </div>
               </div>
               <div class="layui-form-item layui-inline">
                   <label class="layui-form-label">渠道商</label>
                   <div class="layui-input-inline">
                       <input type="text" name="sup_name" placeholder="" class="layui-input">
                   </div>
               </div> 
                </div>
                
                <div class="layui-form-item">  
               <div class="layui-form-item layui-inline">
                   <label class="layui-form-label">渠道编号</label>
                   <div class="layui-input-inline">
                       <input type="text" name="sup_code" placeholder="" class="layui-input">
                   </div>
               </div>   
               <div class="layui-form-item layui-inline">
                   <label class="layui-form-label">渠道色号</label>
                   <div class="layui-input-inline">
                       <input type="text" name="sup_color" placeholder="" class="layui-input">
                   </div>
               </div>
                        <div class="layui-form-item layui-inline">
                       <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="query">
                           <i class="layui-icon layui-icon-search"></i>
                           查询
                       </button>
                       <button type="reset" class="pear-btn pear-btn-md">
                           <i class="layui-icon layui-icon-refresh"></i>
                           重置
                       </button>
                       </div>
                    </div>
				</form>
			</div>
		</div>
		<div class="layui-card">
			<div class="layui-card-body">
				<table id="dataTable" lay-filter="dataTable"></table>
			</div>
		</div>

		<script type="text/html" id="toolbar">
			<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add">
		        <i class="layui-icon layui-icon-add-1"></i>
		        新增
			</button>
			<button class="pear-btn pear-btn-danger pear-btn-md" lay-event="batchRemove">
		        <i class="layui-icon layui-icon-delete"></i>
		        删除
		    </button>
            <button class="pear-btn pear-btn-md" lay-event="recycle">
		        <i class="layui-icon layui-icon-delete"></i>
		        回收站
		    </button>
		</script>

        <script type="text/html" id="color_hex">
            {{#  if(d.color_hex){ }}
            <div class="color-box" style="background-color:#{{ d.color_hex }}"></div>
            {{#  } }}
        </script>
        
        <script type="text/html" id="gray">
            {{#  if(d.gray==0){ }}
            <div>素色</div>
            {{#  }else if(d.gray==1){ }}
            <div>花灰色</div>
            {{#  }else{ }}
            <div>花色</div>
            {{#  } }}
        </script>
        
        <script type="text/html" id="color_code">
            <div class="color_code" copy="{{d.sup_code}} # {{d.sup_color}}#{{d.color_name}}">
                {{ d.color_code }}
            </div>
        </script>
        
       <script type="text/html" id="status">
           <input type="checkbox" name="status" value="{{d.id}}" lay-skin="switch" lay-text="正常|取消" lay-filter="status" {{# if(d.status==1){ }} checked {{# } }}>
       </script>

		<script type="text/html" id="options">
			<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="pop" url="{:U('fabric.color/edit')}/id/{{d.id}}/fabric_id/{{d.fabric_id}}" poptitle="修改面料颜色"><i class="layui-icon layui-icon-edit"></i></button>
		    <button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i class="layui-icon layui-icon-delete"></i></button>
		</script>
        <script>
        layui.use(['jquery','common','mycomm','table'], function() {
            let $ = layui.jquery;
			let common = layui.common;
			let mycomm = layui.mycomm;
			let table = layui.table;
            let MODULE_PATH = "{$MODULE_PATH}";
            
            let cols = [
                [{
                        type: 'checkbox',
                   },{
                       field: "fabric_code",
                       title: "面料编号",
                       width:  100,
                       unresize: "true",
                       align: "center",
                   }, {
                       field: "color_code",
                       title: "色号",
                       width:  100,
                       unresize: "true",
                       align: "center",
                       templet:"#color_code"
                   }, {
                       field: "sup_name",
                       title: "渠道商",
                       width:  100,
                       unresize: "true",
                       align: "center",
                   }, {
                       field: "sup_code",
                       title: "渠道编号",
                       unresize: "true",
                       width:  100,
                       align: "center"
                   }, {
                       field: "sup_color",
                       title: "渠道色号",
                       width:  100,
                       unresize: "true",
                       align: "center",
                   }, {
                       field: "color_name",
                       title: "颜色名称",
                       width:  100,
                       unresize: "true",
                       align: "center"
                   }, {
                       field: "color_hex",
                       title: "颜色参数",
                       width:  150,
                       unresize: "true",
                       align: "center",
                       templet:"#color_hex"
                    },{
                        field: "fabric_name",
                        title: "面料名称",
                        width:  180,
                        unresize: "true",
                        align: "center"
                   }, {
                       field: "gray",
                       title: "颜色类型",
                       width:  100,
                       unresize: "true",
                       align: "center",
                       templet:"#gray"
                   }, {
                       field: "sort",
                       title: "排序",
                       width:  100,
                       hide:true,
                       edit:'text',
                       unresize: "true",
                       align: "center"
                   }, {
                       field: "status",
                       title: "状态",
                       width:  100,
                       unresize: "true",
                       align: "center",
                       templet:"#status"
                   }, {
                        title: '操作',
                        toolbar: '#options',
                        unresize: true,
                        align: 'left',
                    }
                ]
            ]
            
			mycomm.tableInit('{$controller_title}',MODULE_PATH,cols);

        })
    </script>
	{$LOAD_STYLE.bottom|raw}
	</body>
</html>
